Page({
  // 页面的初始数据
  data: {
    "name": "", // 收货人
    "phone": "", // 手机号码
    "provinceName": "", // 省
    "provinceCode": "", // 省编码
    "cityName": "", // 市
    "cityCode": "", // 市编码
    "districtName": "", // 区
    "districtCode": "", // 市编码
    "address": "", // 详细地址
    "fullAddress": "", // 完整地址
    "isDefault": false
  },

  // 保存收货地址
  saveAddrssForm() {
    const { provinceName,cityName,districtName,address,isDefault } = this.data
    const params = {
      ...this.data,
      fullAddress:provinceName+cityName+districtName+address,
      isDefault:isDefault?1:0
    }

  },

  // 省市区选择
  onAddressChange(event) {
    const [provinceName, cityName, districtName] = event.detail.value
    const [provinceCode, cityCode, districtCode] = event.detail.code
    this.setData({
      provinceName,
      cityName,
      districtName,
      provinceCode,
      cityCode,
      districtCode
    })
  }
})
